<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>03-jQuery返回指定祖先元素</title>
  <script src="jquery.js"></script>
</head>

<body>
  <div class="one">
    <div class="two">
      <div class="three">
        <div class="four">
          我不容易
        </div>
      </div>
    </div>
  </div>
  </div>
  <script>
    // 1. 找到one: 一直parent() 太弱智
    console.log($('.four').parent().parent().parent());

    // 2. parents('选择方式'): 返回指定祖先元素
    console.log($('.four').parents('.one'));

  </script>
</body>

</html>